/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.exam;

import org.apache.commons.codec.Encoder;
import org.apache.commons.codec.digest.DigestUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * <p>Project: javase - Ex6
 * <p>Powered by webrx On 2021-12-15 15:24:12
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex6 {
    public static void main(String[] args) throws IOException {
        String a = "C:\\Users\\Administrator\\Desktop\\aa.rar";
        String b = "C:\\Users\\Administrator\\Desktop\\cc.rar";

        var x = DigestUtils.md5Hex(new FileInputStream(a));
        var y = DigestUtils.md5Hex(new FileInputStream(b));
        if (x.equals(y)) {
            System.out.printf("%s 和 %s 是同一个文件", "aa.rar", "cc.rar");
        } else {
            System.out.printf("%s 和 %s 不是同一个文件", "aa.rar", "cc.rar");
        }

        System.out.println(DigestUtils.md5Hex("123"));

    }
}
